{% extends 'reports.html' %}

{% block header %}Reports: Most often rented books{% endblock %}

{% block report %}
<form action="." method="POST">
    {% include "reports/date_controls.html" %}

    <div class="itemsWrapper reportItems">
            <table>
              <thead>
                <tr>
                    <th>Title
                      <input type="image" name="btn_sort_title" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-title" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_title" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-title" value="v" title="Descending"/> -->
                    </th>
                    <th>Number of rentals
                      <input type="image" name="btn_sort_num_rentals" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-num_rentals" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_num_rentals" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-num_rentals" value="v" title="Descending"/> -->
                    </th>
                </tr>
              </thead>
              <tbody>
                {% for book in report %}
                <tr>
                    <td><a href="{% url book_one book.id %}"> {{ book.title }}</a></td>
                    <td>{{ book.num_of_rentals }}</td>
                </tr>
                {% endfor %}
              </tbody>
            </table>
    </div>
</form>
{% endblock %}
